//
// Created by user on 2025/7/29.
//

#ifndef HELLOC_STAGE_HPP
#define HELLOC_STAGE_HPP

#include "systemc"

using namespace sc_core;
using namespace std;


class Stage : public sc_module {
public:
    Stage(sc_module_name name);
    ~Stage();

    void thread();

    void before_end_of_elaboration();

    void end_of_elaboration();

    void start_of_simulation();

    void end_of_simulation();



};

Stage::Stage(sc_module_name name) {
    std::cout << sc_time_stamp() << ": Elaboration: constructor" << std::endl;
    SC_THREAD(thread);
}

Stage::~Stage() {
    std::cout << sc_time_stamp() << ": Cleanup: desctructor" << std::endl;
}

void Stage::thread() {
    std::cout << sc_time_stamp() << ": Execution.initialization" << name() << ": thread" << std::endl;
    int i =0;
    while(true){
        wait(1,SC_SEC);
        std::cout << sc_time_stamp() << ": Execution.simulation" << name() << ": " << i << std::endl;
        if(++i >=2 ){
            sc_stop();
        }
    }
}

void Stage::before_end_of_elaboration() {
    std::cout << sc_time_stamp() << ": Elaboration: before_end_of_elaboration" << std::endl;
}

void Stage::end_of_elaboration() {
    std::cout << sc_time_stamp() << ": Elaboration: end_of_elaboration" << std::endl;
}
void Stage::start_of_simulation() {
    std::cout << sc_time_stamp() << ": Execution.start_of_simulation" << std::endl;
}
void Stage::end_of_simulation() {
    std::cout << sc_time_stamp() << ": Execution.end_of_simulation" << std::endl;
}


#endif //HELLOC_STAGE_HPP
